#!/bin/bash

#Control Center for BigLinux
#
#Authors:
#  Bruno Goncalves Araujo <www.biglinux.com.br>
#
#License: GPLv2 or later
################################################# 

#Mouseover theme
mouseover_open="onmouseover=\"Tip('"
mouseover_close="', BALLOON, true, ABOVE, true, OFFSETX, -17)\" onmouseout=\"UnTip()\""


#Category Background
bigbash_categories_background="/usr/share/bigcontrolcenter/default/images/category-background.png"
bigbash_categories_background_config="align=center width=300 height=50 CELLSPACING=10"


#Category Fonts
bigbash_categories_font="<font size=-1><b>"


#Category variabels
open_categories='<TABLE>'
close_categories='</TABLE>'

function bigbash_header()
{
mkdir ~/.bigcontrolcenter 2> /dev/null
mkdir ~/.bigcontrolcenter/tip/ 2> /dev/null

#Gerar tip com cores diferentes quando alterado no KDE
if [ "$(sed -e '/./{H;$!d;}' -e 'x;/\[qt\]/!d;s/filedialog.*//g;s/GUIEffects.*//g' ~/.config/Trolltech.conf)" != "$(cat ~/.bigcontrolcenter/Trolltech.conf)" ]
then
  cd /usr/share/bigcontrolcenter/default/images/tip
  for img in $(ls *.png)
   do convert -fill $(grep "^Palette.active=" ~/.config/Trolltech.conf | cut -f2 -d ",") -colorize 50% $img $HOME/.bigcontrolcenter/tip/$img
  done
fi
#Altera cor do background-over de acordo com a cor do KDE
  convert /usr/share/bigcontrolcenter/default/images/category-background-over.png  -fill $(grep "^Palette.active=" ~/.config/Trolltech.conf | cut -f13 -d ",") -tint 100 ~/.bigcontrolcenter/category-background-over.png


sed -e '/./{H;$!d;}' -e 'x;/\[qt\]/!d;s/filedialog.*//g;s/GUIEffects.*//g' ~/.config/Trolltech.conf > ~/.bigcontrolcenter/Trolltech.conf

sed "s|/usr/share/bigcontrolcenter/default/images/|$HOME/.bigcontrolcenter/tip/|g" /usr/share/bigcontrolcenter/default/js/tip_balloon.js > $HOME/.bigcontrolcenter/tip_balloon.js
#Fim das alteracoes de cores das imagens

cat << EOF

<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="/usr/share/bigcontrolcenter/default/css/style.css">
<body>
  <script type="text/javascript" src="/usr/share/bigcontrolcenter/default/js/wz_tooltip.js"></script>
  <script type="text/javascript" src="$HOME/.bigcontrolcenter/tip_balloon.js"></script>
EOF
}
echo "$(/usr/share/bigbashview/system-css.sh)"


function bigbash_footer()
{
echo '<hr>Copyleft BigLinux</body>'
}

